home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Environments / SmallEiffel 0.3.3 / SmallEiffel 68k / lib_test / test_recursive_once.e < prev    next >
Encoding:
Text File  |  1996-06-13  |  1.1 KB  |  60 lines  |  [TEXT/EDIT]

  1. -- Part of SmallEiffel -- Read DISCLAIMER file -- Copyright (C) 
  2. -- Dominique COLNET and Suzanne COLLIN -- colnet@loria.fr
  3. --
  4. class TEST_RECURSIVE_ONCE
  5.  
  6. creation make
  7.    
  8. feature 
  9.    
  10.    proc1val: INTEGER;
  11.    
  12.    proc1 is
  13.       once
  14.      proc1;
  15.      proc1val := proc1val + 1;
  16.       end;
  17.    
  18.    fonc1: INTEGER is
  19.       once
  20.      Result := fonc1;
  21.      Result := Result + 1;
  22.       end;
  23.    
  24.    crossf1: INTEGER is
  25.       once
  26.      Result := 3 + crossf2;
  27.       end;
  28.    
  29.    crossf2: INTEGER is
  30.       once
  31.      Result := 2 + crossf1;
  32.       end;
  33.    
  34.    make is
  35.       do
  36.      proc1;
  37.      is_true(proc1val = 1);
  38.      is_true(fonc1 = fonc1);
  39.      is_true(fonc1 = 1);
  40.      is_true(crossf1 = 3 or crossf1 = 5);
  41.      -- What to think of this crazy call :-) 
  42.      -- It is not really clear in E.T.L. :-(
  43.       end;
  44.    
  45.    is_true(b: BOOLEAN) is
  46.       do
  47.      cpt := cpt + 1;
  48.      if not b then
  49.         std_output.put_string("TEST_RECURSIVE_ONCE: ERROR Test # ");
  50.         std_output.put_integer(cpt);
  51.         std_output.put_string("%N");
  52.      else
  53.         -- std_output.put_string("Yes%N");
  54.      end;
  55.       end;
  56.    
  57.    cpt: INTEGER;
  58.    
  59. end -- TEST_RECURSIVE_ONCE
  60.